package com.wanjia.estate.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpringDocConfig {

    @Bean
    public OpenAPI openAPI() {
        return new OpenAPI()
                .info(new Info().title("不动产自助受理机API").version("0.0.1-SNAPSHOT").summary("666"))
                .components(new Components()
                        .addSecuritySchemes("slbh", new SecurityScheme()
                                .in(SecurityScheme.In.HEADER)
                                .type(SecurityScheme.Type.APIKEY)
                                .name("slbh")
                                .description("受理编号")
                        )
                )
                .addSecurityItem(new SecurityRequirement().addList("slbh"));
    }
}
